//
//  SortClassCell.m
//  dyseller
//
//  Created by 红喇叭 on 2017/11/21.
//  Copyright © 2017年 红喇叭. All rights reserved.
//

#import "SortClassCell.h"

@implementation SortClassCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self initView];
    }
    return self;
}


- (void)initView{
    
    _deleteClassBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_deleteClassBtn setImage:[UIImage imageNamed:@"edit_nav_icon4_default_nor"] forState:UIControlStateNormal];
    [self.contentView addSubview:_deleteClassBtn];
    _deleteClassBtn.sd_layout.leftSpaceToView(self.contentView, GETWITH(30)).centerYEqualToView(self.contentView).
    widthIs(GETWITH(40)).heightEqualToWidth();
    
    _foodClassName = [[UILabel alloc] init];
    _foodClassName.textColor = UIColorFromRGB(0x333333);
    _foodClassName.font = font15;
    [self.contentView addSubview:_foodClassName];
    _foodClassName.sd_layout.leftSpaceToView(_deleteClassBtn, GETWITH(30)).topSpaceToView(self.contentView, 15).widthIs(150).heightIs(16);
    
    _foodNum = [[UILabel alloc] init];
    _foodNum.textColor = UIColorFromRGB(0x999999);
    _foodNum.font = font11;
    [self.contentView addSubview:_foodNum];
    _foodNum.sd_layout.leftEqualToView(_foodClassName).topSpaceToView(_foodClassName, 10).widthIs(150).heightIs(12);
    
    _dragBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_dragBtn setImage:[UIImage imageNamed:@"edit_icon2_default_nor"] forState:UIControlStateNormal];
    [self.contentView addSubview:_dragBtn];
    _dragBtn.sd_layout.rightSpaceToView(self.contentView, GETWITH(40)).widthIs(GETWITH(60)).heightEqualToWidth().centerYEqualToView(self.contentView);
    
    _stickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_stickBtn setImage:[UIImage imageNamed:@"edit_icon1_default_nor"] forState:UIControlStateNormal];
    [self.contentView addSubview:_stickBtn];
    _stickBtn.sd_layout.rightSpaceToView(_dragBtn, GETWITH(30)).widthIs(GETWITH(60)).heightEqualToWidth().centerYEqualToView(self.contentView);

    
}

- (void)setDatamModel:(CategoryListModel *)datamModel{
    _datamModel = datamModel;
    _foodClassName.text = _datamModel.category_name;
    _foodNum.text = [NSString stringWithFormat:@"%@个商品",_datamModel.goodsNum];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
